Skip to content

Track more expressions#5596

Open
VincentLanglet wants to merge 6 commits intophpstan:2.1.xfrom
VincentLanglet:fixSpecify
Open

Track more expressions#5596
VincentLanglet wants to merge 6 commits intophpstan:2.1.xfrom
VincentLanglet:fixSpecify

Conversation

@VincentLanglet
Copy link
Copy Markdown
Contributor

@VincentLanglet VincentLanglet commented May 4, 2026

VincentLanglet and others added 5 commits May 4, 2026 09:06
… holders

For property fetches and array dim fetches, the target type in conditional
expression holders must be computed from the right-side scope where the base
object is already narrowed. For example, `$node->name` needs `$node` narrowed
to `FuncCall` (not `CallLike`) to resolve the property type correctly.

Variables keep using the original scope to avoid breaking multi-var isset()
where the right scope has already removed null from the other variable.

Also removes a redundant `!($expr->name instanceof Name)` check that PHPStan
correctly identified as always-true after the preceding elseif branch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@VincentLanglet VincentLanglet marked this pull request as ready for review May 4, 2026 19:02
@VincentLanglet VincentLanglet requested a review from staabm May 4, 2026 19:02
@phpstan-bot
Copy link
Copy Markdown
Collaborator

This pull request has been marked as ready for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants